package com.jtjrenren.android.taxi.passenger.core.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.jtjrenren.android.taxi.passenger.R;
import com.jtjrenren.android.taxi.passenger.bean.api.ApiMaList;
import com.jtjrenren.android.taxi.passenger.base.BaseRcyAdapter;
import com.jtjrenren.android.taxi.passenger.utils.InitView;
import com.nostra13.universalimageloader.core.ImageLoader;

/**
 * Created by Administrator on 2016/1/29.
 */
public class MaterialListAdapter extends BaseRcyAdapter<ApiMaList.MaterialListEntity> {
    public MaterialListAdapter(Context context) {
        super(context);
    }

    @Override
    public RecyclerView.ViewHolder getItemViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.item_material_list, parent, false);
        return new MaterialViewHolder(view);
    }

    @Override
    public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) {
        MaterialViewHolder mHolder = (MaterialViewHolder) holder;

        ApiMaList.MaterialListEntity info = list.get(position);

        mHolder.tv_name.setText(info.getMaterialName());
        mHolder.tv_count.setText(info.getKingtouAmount());
        ImageLoader.getInstance().displayImage(info.getMaterialPhoto(), mHolder.iv_icon, InitView.getDisplayOptions());
    }

    public class MaterialViewHolder extends RecyclerView.ViewHolder {
        TextView tv_name, tv_count;
        ImageView iv_icon;
        Button bt_details;

        public MaterialViewHolder(View itemView) {
            super(itemView);

            tv_name = (TextView) itemView.findViewById(R.id.item_material_name);
            tv_count = (TextView) itemView.findViewById(R.id.item_material_jdcount);
            iv_icon = (ImageView) itemView.findViewById(R.id.item_material_icon);
            bt_details = (Button) itemView.findViewById(R.id.item_material_xq);


        }
    }
}
